<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8" />
	<title>Document</title>
	<link rel="stylesheet" type="text/css" href="Public/Home/css/common.css"/>
	<link rel="stylesheet" type="text/css" href="Public/Home/css/checkout.css"/>
	<link rel="stylesheet" type="text/css" href="Public/Home/css/cart.css"/>
	<!--中间-->
	<div id="AllWrap" style="background: none;">
		<div class="Navigation">
			您当前位置：
			<span>
				<a href="">首页</a>
			</span>
		</div>
		<div class="CartWrap">
			<?php if(isset($_SESSION['cart']['total_rows'])){?>
                
			<div class="stepbj2">
				<span class="step1">
					<a href="">购物车</a>
				</span>
				<span class="step2">填写订单并确认</span>
				<span class="step3">成功提交订单</span>
			</div>
			<form method="post" class="order_create">
				<!--购物车-->
				<div id="goodsbody">
					<table class="cart_list" border="0" cellspacing="0" cellpadding="0" width="100%">
						<tr>
							<th>商品名称</th>
							<th class="th_line"></th>
							<th>单价</th>
							<th class="th_line"></th>
							<th>数量</th>
							<th class="th_line"></th>
							<th>金额小计</th>
							<th class="th_line"></th>
							<th>积分</th><th class="th_line"></th>
							<th>操作</th>
						</tr>
						<script type="text/javascript">
										$(function(){
											$(".CartNav_del").click(function(){
												var i = $(this).attr('shujusid');
												var c = $(".CartNav_del").length;
												$(this).parents('.havechild').remove()
												$.ajax({
													type:"post",
													url:"<?php echo U('del')?>",
													data:{sjsid:i},
													dataType:"json",
													success:function(data){
														
													}
												});
											})
										})
									</script>
							<script type="text/javascript">
								$(function(){
									//	点击物品数量的+
								//获取input的值,再加1,写入input
									$(".increase").click(function(){
										var l ="";
										l += $(this).attr('jiafa')+","; 
										var t = $(this).parent('.numadjust_arr').prev('#shul').val();
										l += parseInt(t)+1;
											z = parseInt(t)+1;
										$(this).parent('.numadjust_arr').prev('#shul').val(z);
										//抓取一个商品的总价
										var x = $(this).parents('.shul_iang').siblings('.textcenter').find('.zongjia').html();
										//抓取单价的值
										var d = $(this).parents('.shul_iang').siblings('.xuanze').find('.danjia').html();
										//计算一个商品的总价
										var zj = parseInt(x)+parseInt(d);
										//复制回总价
										$(this).parents('.shul_iang').siblings('.textcenter').find('.zongjia').html(zj);
										//抓取总价
										var zzj = $(".totalprice").html();
										var a = parseInt(zzj)+parseInt(d);
										$(".totalprice").html(a);
										//商品总金额
										var spz = $(".font_orange").html();
										var aa = parseInt(spz)+parseInt(d);
										$(".font_orange").html(aa);
										$.ajax({
											type:"post",
											url:"<?php echo U('jiafa')?>",
											data:{jf:l},
											dataType:"json",
											success:function(data){
												$(this).parent('.numadjust_arr').prev('#shul').val(data);
											}
										});
									})
							
									})
								</script>
								<script type="text/javascript">
									$(function(){
										$(".decrease").click(function(){
											var l ="";
											l += $(this).attr('jianfa')+","; 
											var t = $(this).parent('.numadjust_arr').prev('#shul').val();
											l += parseInt(t)-1;
												z = parseInt(t)-1;
										if(t>1){
											$(this).parent('.numadjust_arr').prev('#shul').val(z);
											//抓取一个商品的总价
										var x = $(this).parents('.shul_iang').siblings('.textcenter').find('.zongjia').html();
										//抓取单价的值
										var d = $(this).parents('.shul_iang').siblings('.xuanze').find('.danjia').html();
										//计算一个商品的总价
										var zj = parseInt(x)-parseInt(d);
										//复制回总价
										$(this).parents('.shul_iang').siblings('.textcenter').find('.zongjia').html(zj);
										//抓取总价
										var zzj = $(".totalprice").html();
										var a = parseInt(zzj)-parseInt(d);
										$(".totalprice").html(a);
										//商品总金额
										var spz = $(".font_orange").html();
										var aa = parseInt(spz)-parseInt(d);
										$(".font_orange").html(aa);
											$.ajax({
												type:"post",
												url:"<?php echo U('jianfa')?>",
												data:{jian:l},
												dataType:"json",
												success:function(data){
													$(this).parent('.numadjust_arr').prev('#shul').val(data);
												}
											});
										}
										})
									})
								</script>
						<?php foreach ($shuju as $k=>$v){?>
						<tr class="havechild">
							<td style="width: 350px;">
								<div class="goodpic">
									<a href=""><img src="<?php echo $v['thumb']?>" style="height: 50px;width: 50px;"/></a>
								</div>
								<div class="goods_main">
									<div class="font_gray">
										<h6>
											<a class="font_blue" href="<?php echo U('Goods/index',array('sid'=>$v['id']))?>"><?php echo $v['name']?></a>
										</h6>
										上装尺码：<?php echo $v['options']['size']?>
									</div>
								</div>
							</td>
							<td></td>
							<td class="xuanze">
								<p class="danjia"><?php echo $v['price']?></p>
							</td>
							<td></td>
							<td class="shul_iang">
								<input type="text" name="shuliang" id="shul" value="<?php echo $v['num']?>" />
								<div class="numadjust_arr">
									<span class="increase" jiafa="<?php echo $k?>"></span>
									<span class="decrease" jianfa="<?php echo $k?>"></span>
								</div>
							
							</td>
							<td></td>
							<td class="textcenter">
								<p class="zongjia"><?php echo $v['total']?></p>
							</td>
							<td></td>
							<td>
								<p>0</p>
							</td>
							<td></td>
							<td class="vm">
								<ul class="cart_coll_ul">
									<li class="star_off">
										<a href="">
											<span>
												<div class="fav">收藏</div>
												<div class="nofav">已收藏</div>
											</span>
										</a>
									</li>
									<li>
										<a class="CartNav_del" style="cursor: pointer;"  shujusid="<?php echo $k?>">
											<i><img src="Public/Home/img/delecate.gif"/></i>
											<span>删除</span>
										</a>
									</li>
								</ul>
							</td>
						</tr>
						<?php }?>
					</table>
				</div>
				<div class="sales_promotion">
					<h4>已享受的促销优惠</h4>
					<ul>
						<li class="clearfix">
							<p>全场满99元免邮</p>
							<p>凡在商城内购物满99元，即享受免邮特惠</p>
						</li>
					</ul>
					<ul class="clearfix_sp">
							<li>
								商品金额：
								<span class="font_orange"><?php echo $zongjia?></span>
							</li>
							<li>
								总金额：
								<span class="free_cost">(免运费)</span>
								<span class="totalprice"><?php echo $zongjia?></span>
							</li>
						</ul>
				</div>
				<!--结算信息-->
				<div class="section">
					<div class="form_title">
						<div class="acco_wrap">
							<div class="del_cart">
								<a href="javascript:;"  onclick="if(confirm('确定删除吗？')) location.href='<?php echo U("maxdel")?>'">批量删除</a>
							</div>
							<button type="button" class="order_btn">
								<?php if(isset($_SESSION['nickname'])){?>
                
								<span onclick="location.href='checkout.html'">结算</span>
								<?php }else{?>
								<span onclick="if(confirm('请先登录')) location.href='logo.html'">结算</span>
								
               <?php }?>
							</button>
						</div>
					</div>
				</div>
				<?php }else{?>
				<div id="goodsbody">
					<table class="cart_list" border="0" cellspacing="0" cellpadding="0" width="100%">
						<tr>
							<th>商品名称</th>
							<th class="th_line"></th>
							<th>单价</th>
							<th class="th_line"></th>
							<th>数量</th>
							<th class="th_line"></th>
							<th>金额小计</th>
							<th class="th_line"></th>
							<th>积分</th><th class="th_line"></th>
							<th>操作</th>
						</tr>
					</table>
				</div>
				<div class="sales_promotion" style="height: 150px; text-align: center; line-height: 150px; font-size: 18px;">
					您的购物车里还没有商品,请您先<a href="<?php echo U('Index/index')?>" style="color: red;">选购商品>></a>
				</div>
				<!--结算信息-->
				<div class="section">
				</div>
				
               <?php }?>
				<div class="sales_promotion">
					<h4>你可能会喜欢</h4>
				<?php if(isset($_SESSION['cart']['total_rows'])){?>
                
					<ul class="maybe_like">
						<?php foreach ($GoodsData as $k=>$v){?>
						<li class="single_pro">
							<a href="goods_<?php echo $v['sid']?>.html"><img style="height: 199px; width: 199px;" src="<?php echo $v['thumb']?>"/></a>
							<div class="goodinfo">
								<a href="goods_<?php echo $v['sid']?>.html"><?php echo $v['sname']?></a>
							</div>
							<p class="price_wrap">
								<?php echo $v['sale']?> 
								<del><?php echo $v['market']?></del>
							</p>
						</li>
						<?php }?>
					</ul>
				
               <?php }?>
				</div>
			</form>
		</div>
	</div>
	<!--底部共享區域-->
	<div id="footer">
		<div class="footer_box">
			<ul class="help_wrap">
				<li>
					<div class="TreeList">
						<div class="TreeListTitle">
							<a href="">新手指南</a>
						</div>
						<div class="TreeListContent">
							<div class="cat_1">
								<a href="">新用戶註冊</a>
							</div>
							<div class="cat_1">
								<a href="">用户协议</a>
							</div>
						</div>
					</div>
				</li>
				<li>
					<div class="TreeList">
						<div class="TreeListTitle">
							<a href="">服务相关</a>
						</div>
						<div class="TreeListContent">
							<div class="cat_1">
								<a href="">退款方式</a>
							</div>
							<div class="cat_1">
								<a href="">退换货政策</a>
							</div>
							<div class="cat_1">
								<a href="">账户管理</a>
							</div>
						</div>
					</div>
				</li>
				<li>
					<div class="TreeList">
						<div class="TreeListTitle">
							<a href="">配送服务</a>
						</div>
						<div class="TreeListContent">
							<div class="cat_1">
								<a href="">配送方式</a>
							</div>
							<div class="cat_1">
								<a href="">配送费用</a>
							</div>
							<div class="cat_1">
								<a href="">快递查询</a>
							</div>
							<div class="cat_1">
								<a href="">包装形式</a>
							</div>
						</div>
					</div>
				</li>
				<li>
					<div class="TreeList">
						<div class="TreeListTitle">
							<a href="">购物指南</a>
						</div>
						<div class="TreeListContent">
							<div class="cat_1">
								<a href="">线上购物流程</a>
							</div>
							<div class="cat_1">
								<a href="">订单质询</a>
							</div>
						</div>
					</div>
				</li>
				<li>
					<div class="TreeList">
						<div class="TreeListTitle">
							<a href="">支付方式</a>
						</div>
						<div class="TreeListContent">
							<div class="cat_1">
								<a href="">支付方式</a>
							</div>
							<div class="cat_1">
								<a href="">发票制度</a>
							</div>
						</div>
					</div>
				</li>
			</ul>
			<div class="surput_wrap">
				<ul>
					<li class="li_1">7天退换货保障</li>
					<li class="li_2">正品保障</li>
					<li class="li_3">单笔订单满99元</li>
					<li class="li_4">
						<a href="">在线客服</a>
					</li>
				</ul>
			</div>
		</div>
		<div id="ad_banner"></div>
	<div id="banquan">
		<span>©版权所有 2012 上海卡帕体育用品有限公司 备案号 京ICP备11012820号-1</span>
	</div>
	</div>
</body>
</html>






